/***************************************************
 * Input Forms Js	
 * V_1.0.0
 * 2013.11.22
 * xzq 
 * ***********************************************/
/**表单提交**/
function formSubmit(url){
	$.ajax({
		type:'post',
		url:url,
		data:$('#INFO_FORM').serialize(),
		success:function(data){
			if(data == 1){
				alert("设置成功");
			}else{
				alert("设置失败");
			}
		},
		error:function(){
			alert("发送错误");
		}
		
	});

}

var selId = 'sel';
/***加载相似信息**/
function loadSameStr(obj,inputType,basePath){
	if(inputType!=''){
		var sameHtml = "<div id='"+selId+"' class='myDiv' style='left:10px; top:40px; width:150px; height:" +
		"100px; visibility:hidden;'>";
		sameHtml += "</div>";
		$(obj).after(sameHtml);
		$.ajax({
			type:"post",
			url:basePath+"/sys/getSameInfoStr",
			data:"inputType="+inputType+"&str="+$(obj).val(),
			success:function(data){
				addSameInfo(obj,data);
			}
		});
	}
}

//相似数据框
function addSameInfo(obj,data){
	var sameHtml = "";
	for(var i = 0; i < data.length; i++){
		sameHtml += "<div><a href=javascript:getValue('"+$(obj).attr('name')+"','"+data[i]+"')>"+data[i]+"</a></div>";
	}
	$('#sel').html(sameHtml);
	var div = document.getElementById(selId);
	div.style.visibility = "visible";
}

//选择值
function getValue(targetObj,sourceObj){
	document.getElementsByName(targetObj)[0].value = sourceObj;;
	hideDiv();
}

function hideDiv(){
	var div = document.getElementById(selId);
	div.style.visibility="hidden";
}



